import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main1497 {
    static Comparator<Integer> cmp = new Comparator<Integer>() {
        public int compare(Integer a, Integer b) {
            return b-a;
        }
    };

    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        Integer[] arr=new Integer[n];
        for (int i=0;i<n;i++){
            arr[i]=sc.nextInt();
        }
        int x=sc.nextInt();
        Arrays.sort(arr,cmp);

        for (int i=x-1;i<n;i++){
            System.out.print(arr[i]);
            break;
        }
    }
}